<template>
  <div>
    <el-carousel v-if="fixedComponentsBannerDataList.length" height="308px">
      <el-carousel-item v-for="item in fixedComponentsBannerDataList" :key="item">
        <img :src="item.imgUrl" alt="" class="swiper-img cursor-p" @click="handleJumpPage(item)">
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script lang="ts">
  import {
    useRouter
  } from 'vue-router'
  import {
    defineComponent,
    ref,
    onMounted,
    watch,
    inject
  } from 'vue'
  import {
    jumpPage
  } from '@/utils/jumpPageUtils'
  export default defineComponent({
    name: 'BannerSwiper',
    setup() {
      const router = useRouter()
      const fixedComponentsBannerDataList = inject('fixedComponentsBannerDataList')
      onMounted(() => {

      })
      const handleJumpPage = (item) => {
        jumpPage(router, item.hasLink, item.linkTarget, item.linkType, item.linkParams, item.newPage)
      }
      return {
        fixedComponentsBannerDataList,
        handleJumpPage
      }
    }
  })
</script>

<style lang="scss" scoped>
  $darkBlue: #182245;

  .el-carousel__item {
    text-align: center;
  }

  .swiper-img {
    width: 884px;
    height: 308px;
  }
</style>
